/* 
  用于寻找连续点符号的属性，例如a.b.c console.log(a[b.c])
  面试题
*/
export default function lookup(dataObj, keyName) {

  if (keyName.indexOf('.') >0) {
    let keys = keyName.split('.')
    let temp = dataObj

    for (let i = 0; i < keys.length; i++) {
      temp = temp[keys[i]]
    }

    return temp
  }

  return dataObj[keyName]
}